home *** CD-ROM | disk | FTP | other *** search
/ Language/OS - Multiplatform Resource Library / LANGUAGE OS.iso / scheme / schmrprt / r4rs.lha / basic.tex < prev    next >
LaTeX Document  |  1991-11-08  |  8.4 KB

open in: MacOS 8.1     |     Win98     |     DOS

browse contents    |     view JSON data     |     view as text


This file was processed as: LaTeX Document (document/latex).

ConfidenceProgramDetectionMatch TypeSupport
100% dexvert LaTeX Document (document/latex) magic Supported
1% dexvert Text File (text/txt) fallback Supported
100% file LaTeX document text default
99% file LaTeX document, ASCII text default
100% checkBytes Printable ASCII default
100% perlTextCheck Likely Text (Perl) default
100% siegfried fmt/281 LaTeX (Subdocument) default
100% detectItEasy Format: plain text[LF] default (weak)



hex view
+--------+-------------------------+-------------------------+--------+--------+
|00000000| 25 5c 76 66 69 6c 6c 5c | 65 6a 65 63 74 0a 5c 63 |%\vfill\|eject.\c|
|00000010| 68 61 70 74 65 72 7b 42 | 61 73 69 63 20 63 6f 6e |hapter{B|asic con|
|00000020| 63 65 70 74 73 7d 0a 5c | 6c 61 62 65 6c 7b 62 61 |cepts}.\|label{ba|
|00000030| 73 69 63 63 68 61 70 74 | 65 72 7d 0a 0a 5c 73 65 |sicchapt|er}..\se|
|00000040| 63 74 69 6f 6e 7b 56 61 | 72 69 61 62 6c 65 73 20 |ction{Va|riables |
|00000050| 61 6e 64 20 72 65 67 69 | 6f 6e 73 7d 0a 5c 6c 61 |and regi|ons}.\la|
|00000060| 62 65 6c 7b 73 70 65 63 | 69 61 6c 66 6f 72 6d 73 |bel{spec|ialforms|
|00000070| 65 63 74 69 6f 6e 7d 0a | 5c 6c 61 62 65 6c 7b 76 |ection}.|\label{v|
|00000080| 61 72 69 61 62 6c 65 73 | 65 63 74 69 6f 6e 7d 0a |ariables|ection}.|
|00000090| 0a 41 6e 79 20 69 64 65 | 6e 74 69 66 69 65 72 20 |.Any ide|ntifier |
|000000a0| 74 68 61 74 20 69 73 20 | 6e 6f 74 20 61 20 73 79 |that is |not a sy|
|000000b0| 6e 74 61 63 74 69 63 20 | 6b 65 79 77 6f 72 64 5c |ntactic |keyword\|
|000000c0| 69 6e 64 65 78 7b 6b 65 | 79 77 6f 72 64 7d 20 28 |index{ke|yword} (|
|000000d0| 73 65 65 0a 73 65 63 74 | 69 6f 6e 7e 5c 72 65 66 |see.sect|ion~\ref|
|000000e0| 7b 6b 65 79 77 6f 72 64 | 73 65 63 74 69 6f 6e 7d |{keyword|section}|
|000000f0| 29 20 6d 61 79 20 62 65 | 20 75 73 65 64 20 61 73 |) may be| used as|
|00000100| 20 61 20 76 61 72 69 61 | 62 6c 65 2e 5c 69 6e 64 | a varia|ble.\ind|
|00000110| 65 78 7b 73 79 6e 74 61 | 63 74 69 63 0a 6b 65 79 |ex{synta|ctic.key|
|00000120| 77 6f 72 64 7d 5c 69 6e | 64 65 78 7b 69 64 65 6e |word}\in|dex{iden|
|00000130| 74 69 66 69 65 72 7d 5c | 6d 61 69 6e 69 6e 64 65 |tifier}\|maininde|
|00000140| 78 7b 76 61 72 69 61 62 | 6c 65 7d 20 20 41 20 76 |x{variab|le} A v|
|00000150| 61 72 69 61 62 6c 65 20 | 6d 61 79 20 6e 61 6d 65 |ariable |may name|
|00000160| 20 61 0a 6c 6f 63 61 74 | 69 6f 6e 20 77 68 65 72 | a.locat|ion wher|
|00000170| 65 20 61 20 76 61 6c 75 | 65 20 63 61 6e 20 62 65 |e a valu|e can be|
|00000180| 20 73 74 6f 72 65 64 2e | 20 20 41 20 76 61 72 69 | stored.| A vari|
|00000190| 61 62 6c 65 20 74 68 61 | 74 20 64 6f 65 73 20 73 |able tha|t does s|
|000001a0| 6f 20 69 73 20 73 61 69 | 64 0a 74 6f 20 62 65 20 |o is sai|d.to be |
|000001b0| 7b 5c 65 6d 20 62 6f 75 | 6e 64 7d 20 74 6f 20 74 |{\em bou|nd} to t|
|000001c0| 68 65 20 6c 6f 63 61 74 | 69 6f 6e 2e 20 20 54 68 |he locat|ion. Th|
|000001d0| 65 20 73 65 74 20 6f 66 | 20 61 6c 6c 20 76 69 73 |e set of| all vis|
|000001e0| 69 62 6c 65 0a 62 69 6e | 64 69 6e 67 73 5c 6d 61 |ible.bin|dings\ma|
|000001f0| 69 6e 69 6e 64 65 78 7b | 62 69 6e 64 69 6e 67 7d |inindex{|binding}|
|00000200| 20 69 6e 20 65 66 66 65 | 63 74 20 61 74 20 73 6f | in effe|ct at so|
|00000210| 6d 65 20 70 6f 69 6e 74 | 20 69 6e 20 61 20 70 72 |me point| in a pr|
|00000220| 6f 67 72 61 6d 20 69 73 | 0a 6b 6e 6f 77 6e 20 61 |ogram is|.known a|
|00000230| 73 20 74 68 65 20 7b 5c | 65 6d 20 65 6e 76 69 72 |s the {\|em envir|
|00000240| 6f 6e 6d 65 6e 74 7d 20 | 69 6e 20 65 66 66 65 63 |onment} |in effec|
|00000250| 74 20 61 74 20 74 68 61 | 74 20 70 6f 69 6e 74 2e |t at tha|t point.|
|00000260| 20 20 54 68 65 20 76 61 | 6c 75 65 0a 73 74 6f 72 | The va|lue.stor|
|00000270| 65 64 20 69 6e 20 74 68 | 65 20 6c 6f 63 61 74 69 |ed in th|e locati|
|00000280| 6f 6e 20 74 6f 20 77 68 | 69 63 68 20 61 20 76 61 |on to wh|ich a va|
|00000290| 72 69 61 62 6c 65 20 69 | 73 20 62 6f 75 6e 64 20 |riable i|s bound |
|000002a0| 69 73 20 63 61 6c 6c 65 | 64 20 74 68 65 0a 76 61 |is calle|d the.va|
|000002b0| 72 69 61 62 6c 65 27 73 | 20 76 61 6c 75 65 2e 20 |riable's| value. |
|000002c0| 20 42 79 20 61 62 75 73 | 65 20 6f 66 20 74 65 72 | By abus|e of ter|
|000002d0| 6d 69 6e 6f 6c 6f 67 79 | 2c 20 74 68 65 20 76 61 |minology|, the va|
|000002e0| 72 69 61 62 6c 65 20 69 | 73 20 73 6f 6d 65 74 69 |riable i|s someti|
|000002f0| 6d 65 73 0a 73 61 69 64 | 20 74 6f 20 6e 61 6d 65 |mes.said| to name|
|00000300| 20 74 68 65 20 76 61 6c | 75 65 20 6f 72 20 74 6f | the val|ue or to|
|00000310| 20 62 65 20 62 6f 75 6e | 64 20 74 6f 20 74 68 65 | be boun|d to the|
|00000320| 20 76 61 6c 75 65 2e 20 | 20 54 68 69 73 20 69 73 | value. | This is|
|00000330| 20 6e 6f 74 20 71 75 69 | 74 65 0a 61 63 63 75 72 | not qui|te.accur|
|00000340| 61 74 65 2c 20 62 75 74 | 20 63 6f 6e 66 75 73 69 |ate, but| confusi|
|00000350| 6f 6e 20 72 61 72 65 6c | 79 20 72 65 73 75 6c 74 |on rarel|y result|
|00000360| 73 20 66 72 6f 6d 20 74 | 68 69 73 20 70 72 61 63 |s from t|his prac|
|00000370| 74 69 63 65 2e 0a 0a 5c | 74 6f 64 6f 7b 44 65 66 |tice...\|todo{Def|
|00000380| 69 6e 65 20 60 60 61 73 | 73 69 67 6e 65 64 27 27 |ine ``as|signed''|
|00000390| 20 61 6e 64 20 60 60 75 | 6e 61 73 73 69 67 6e 65 | and ``u|nassigne|
|000003a0| 64 27 27 20 70 65 72 68 | 61 70 73 3f 7d 0a 0a 5c |d'' perh|aps?}..\|
|000003b0| 74 6f 64 6f 7b 49 6e 20 | 70 72 6f 67 72 61 6d 73 |todo{In |programs|
|000003c0| 20 77 69 74 68 6f 75 74 | 20 73 69 64 65 20 65 66 | without| side ef|
|000003d0| 66 65 63 74 73 2c 20 6f | 6e 65 20 63 61 6e 20 73 |fects, o|ne can s|
|000003e0| 61 66 65 6c 79 20 70 72 | 65 74 65 6e 64 20 74 68 |afely pr|etend th|
|000003f0| 61 74 20 74 68 65 0a 76 | 61 72 69 61 62 6c 65 73 |at the.v|ariables|
|00000400| 20 61 72 65 20 62 6f 75 | 6e 64 20 64 69 72 65 63 | are bou|nd direc|
|00000410| 74 6c 79 20 74 6f 20 74 | 68 65 20 61 72 67 75 6d |tly to t|he argum|
|00000420| 65 6e 74 73 2e 20 20 4f | 72 3a 0a 49 6e 20 70 72 |ents. O|r:.In pr|
|00000430| 6f 67 72 61 6d 73 20 77 | 69 74 68 6f 75 74 20 5c |ograms w|ithout \|
|00000440| 69 64 65 7b 73 65 74 21 | 7d 2c 20 6f 6e 65 20 63 |ide{set!|}, one c|
|00000450| 61 6e 20 73 61 66 65 6c | 79 20 70 72 65 74 65 6e |an safel|y preten|
|00000460| 64 20 74 68 61 74 20 74 | 68 65 0a 76 61 72 69 61 |d that t|he.varia|
|00000470| 62 6c 65 20 69 73 20 62 | 6f 75 6e 64 20 64 69 72 |ble is b|ound dir|
|00000480| 65 63 74 6c 79 20 74 6f | 20 74 68 65 20 76 61 6c |ectly to| the val|
|00000490| 75 65 2e 20 7d 0a 0a 5c | 76 65 73 74 20 43 65 72 |ue. }..\|vest Cer|
|000004a0| 74 61 69 6e 20 65 78 70 | 72 65 73 73 69 6f 6e 20 |tain exp|ression |
|000004b0| 74 79 70 65 73 20 61 72 | 65 20 75 73 65 64 20 74 |types ar|e used t|
|000004c0| 6f 20 63 72 65 61 74 65 | 20 6e 65 77 20 6c 6f 63 |o create| new loc|
|000004d0| 61 74 69 6f 6e 73 20 61 | 6e 64 20 74 6f 0a 62 69 |ations a|nd to.bi|
|000004e0| 6e 64 20 76 61 72 69 61 | 62 6c 65 73 20 74 6f 20 |nd varia|bles to |
|000004f0| 74 68 6f 73 65 20 6c 6f | 63 61 74 69 6f 6e 73 2e |those lo|cations.|
|00000500| 20 20 54 68 65 20 6d 6f | 73 74 20 66 75 6e 64 61 | The mo|st funda|
|00000510| 6d 65 6e 74 61 6c 20 6f | 66 20 74 68 65 73 65 20 |mental o|f these |
|00000520| 7b 5c 65 6d 0a 62 69 6e | 64 69 6e 67 20 63 6f 6e |{\em.bin|ding con|
|00000530| 73 74 72 75 63 74 73 7d | 5c 6d 61 69 6e 69 6e 64 |structs}|\mainind|
|00000540| 65 78 7b 62 69 6e 64 69 | 6e 67 20 63 6f 6e 73 74 |ex{bindi|ng const|
|00000550| 72 75 63 74 7d 20 69 73 | 20 74 68 65 0a 5c 6c 61 |ruct} is| the.\la|
|00000560| 6d 62 64 61 65 78 70 7b | 7d 5c 69 6e 64 65 78 7b |mbdaexp{|}\index{|
|00000570| 5c 6c 61 6d 62 64 61 65 | 78 70 7b 7d 7d 2c 20 62 |\lambdae|xp{}}, b|
|00000580| 65 63 61 75 73 65 20 61 | 6c 6c 20 6f 74 68 65 72 |ecause a|ll other|
|00000590| 20 62 69 6e 64 69 6e 67 | 20 63 6f 6e 73 74 72 75 | binding| constru|
|000005a0| 63 74 73 0a 63 61 6e 20 | 62 65 20 65 78 70 6c 61 |cts.can |be expla|
|000005b0| 69 6e 65 64 20 69 6e 20 | 74 65 72 6d 73 20 6f 66 |ined in |terms of|
|000005c0| 20 5c 6c 61 6d 62 64 61 | 65 78 70 7b 7d 73 2e 20 | \lambda|exp{}s. |
|000005d0| 20 54 68 65 20 6f 74 68 | 65 72 20 62 69 6e 64 69 | The oth|er bindi|
|000005e0| 6e 67 0a 63 6f 6e 73 74 | 72 75 63 74 73 20 61 72 |ng.const|ructs ar|
|000005f0| 65 20 5c 69 64 65 7b 6c | 65 74 7d 2c 20 5c 69 64 |e \ide{l|et}, \id|
|00000600| 65 7b 6c 65 74 2a 7d 2c | 20 5c 69 64 65 7b 6c 65 |e{let*},| \ide{le|
|00000610| 74 72 65 63 7d 2c 20 61 | 6e 64 20 5c 69 64 65 7b |trec}, a|nd \ide{|
|00000620| 64 6f 7d 0a 65 78 70 72 | 65 73 73 69 6f 6e 73 20 |do}.expr|essions |
|00000630| 28 73 65 65 20 73 65 63 | 74 69 6f 6e 73 7e 5c 72 |(see sec|tions~\r|
|00000640| 65 66 7b 6c 61 6d 62 64 | 61 7d 2c 20 5c 72 65 66 |ef{lambd|a}, \ref|
|00000650| 7b 6c 65 74 72 65 63 7d | 2c 20 61 6e 64 20 5c 72 |{letrec}|, and \r|
|00000660| 65 66 7b 64 6f 7d 29 2e | 0a 0a 25 4e 6f 74 65 3a |ef{do}).|..%Note:|
|00000670| 20 69 6e 74 65 72 6e 61 | 6c 20 64 65 66 69 6e 69 | interna|l defini|
|00000680| 74 69 6f 6e 73 20 6e 6f | 74 20 6d 65 6e 74 69 6f |tions no|t mentio|
|00000690| 6e 65 64 20 68 65 72 65 | 2e 0a 0a 5c 76 65 73 74 |ned here|...\vest|
|000006a0| 20 4c 69 6b 65 20 41 6c | 67 6f 6c 20 61 6e 64 20 | Like Al|gol and |
|000006b0| 50 61 73 63 61 6c 2c 20 | 61 6e 64 20 75 6e 6c 69 |Pascal, |and unli|
|000006c0| 6b 65 20 6d 6f 73 74 20 | 6f 74 68 65 72 20 64 69 |ke most |other di|
|000006d0| 61 6c 65 63 74 73 20 6f | 66 20 4c 69 73 70 0a 65 |alects o|f Lisp.e|
|000006e0| 78 63 65 70 74 20 66 6f | 72 20 43 6f 6d 6d 6f 6e |xcept fo|r Common|
|000006f0| 20 4c 69 73 70 2c 20 53 | 63 68 65 6d 65 20 69 73 | Lisp, S|cheme is|
|00000700| 20 61 20 73 74 61 74 69 | 63 61 6c 6c 79 20 73 63 | a stati|cally sc|
|00000710| 6f 70 65 64 20 6c 61 6e | 67 75 61 67 65 20 77 69 |oped lan|guage wi|
|00000720| 74 68 0a 62 6c 6f 63 6b | 20 73 74 72 75 63 74 75 |th.block| structu|
|00000730| 72 65 2e 20 20 54 6f 20 | 65 61 63 68 20 70 6c 61 |re. To |each pla|
|00000740| 63 65 20 77 68 65 72 65 | 20 61 20 76 61 72 69 61 |ce where| a varia|
|00000750| 62 6c 65 20 69 73 20 62 | 6f 75 6e 64 20 69 6e 20 |ble is b|ound in |
|00000760| 61 20 70 72 6f 67 72 61 | 6d 0a 74 68 65 72 65 20 |a progra|m.there |
|00000770| 63 6f 72 72 65 73 70 6f | 6e 64 73 20 61 20 5c 64 |correspo|nds a \d|
|00000780| 65 66 69 6e 69 6e 67 7b | 72 65 67 69 6f 6e 7d 20 |efining{|region} |
|00000790| 6f 66 20 74 68 65 20 70 | 72 6f 67 72 61 6d 20 74 |of the p|rogram t|
|000007a0| 65 78 74 20 77 69 74 68 | 69 6e 20 77 68 69 63 68 |ext with|in which|
|000007b0| 0a 74 68 65 20 62 69 6e | 64 69 6e 67 20 69 73 20 |.the bin|ding is |
|000007c0| 65 66 66 65 63 74 69 76 | 65 2e 20 20 54 68 65 20 |effectiv|e. The |
|000007d0| 72 65 67 69 6f 6e 20 69 | 73 20 64 65 74 65 72 6d |region i|s determ|
|000007e0| 69 6e 65 64 20 62 79 20 | 74 68 65 20 70 61 72 74 |ined by |the part|
|000007f0| 69 63 75 6c 61 72 0a 62 | 69 6e 64 69 6e 67 20 63 |icular.b|inding c|
|00000800| 6f 6e 73 74 72 75 63 74 | 20 74 68 61 74 20 65 73 |onstruct| that es|
|00000810| 74 61 62 6c 69 73 68 65 | 73 20 74 68 65 20 62 69 |tablishe|s the bi|
|00000820| 6e 64 69 6e 67 3b 20 69 | 66 20 74 68 65 20 62 69 |nding; i|f the bi|
|00000830| 6e 64 69 6e 67 20 69 73 | 0a 65 73 74 61 62 6c 69 |nding is|.establi|
|00000840| 73 68 65 64 20 62 79 20 | 61 20 5c 6c 61 6d 62 64 |shed by |a \lambd|
|00000850| 61 65 78 70 7b 7d 2c 20 | 66 6f 72 20 65 78 61 6d |aexp{}, |for exam|
|00000860| 70 6c 65 2c 20 74 68 65 | 6e 20 69 74 73 20 72 65 |ple, the|n its re|
|00000870| 67 69 6f 6e 0a 69 73 20 | 74 68 65 20 65 6e 74 69 |gion.is |the enti|
|00000880| 72 65 20 5c 6c 61 6d 62 | 64 61 65 78 70 7b 7d 2e |re \lamb|daexp{}.|
|00000890| 20 20 45 76 65 72 79 20 | 72 65 66 65 72 65 6e 63 | Every |referenc|
|000008a0| 65 20 74 6f 20 6f 72 20 | 61 73 73 69 67 6e 6d 65 |e to or |assignme|
|000008b0| 6e 74 20 6f 66 20 61 0a | 76 61 72 69 61 62 6c 65 |nt of a.|variable|
|000008c0| 20 72 65 66 65 72 73 20 | 74 6f 20 74 68 65 20 62 | refers |to the b|
|000008d0| 69 6e 64 69 6e 67 20 6f | 66 20 74 68 65 20 76 61 |inding o|f the va|
|000008e0| 72 69 61 62 6c 65 20 74 | 68 61 74 20 65 73 74 61 |riable t|hat esta|
|000008f0| 62 6c 69 73 68 65 64 20 | 74 68 65 0a 69 6e 6e 65 |blished |the.inne|
|00000900| 72 6d 6f 73 74 20 6f 66 | 20 74 68 65 20 72 65 67 |rmost of| the reg|
|00000910| 69 6f 6e 73 20 63 6f 6e | 74 61 69 6e 69 6e 67 20 |ions con|taining |
|00000920| 74 68 65 20 75 73 65 2e | 20 20 49 66 20 74 68 65 |the use.| If the|
|00000930| 72 65 20 69 73 20 6e 6f | 20 62 69 6e 64 69 6e 67 |re is no| binding|
|00000940| 20 6f 66 0a 74 68 65 20 | 76 61 72 69 61 62 6c 65 | of.the |variable|
|00000950| 20 77 68 6f 73 65 20 72 | 65 67 69 6f 6e 20 63 6f | whose r|egion co|
|00000960| 6e 74 61 69 6e 73 20 74 | 68 65 20 75 73 65 2c 20 |ntains t|he use, |
|00000970| 74 68 65 6e 20 74 68 65 | 20 75 73 65 20 72 65 66 |then the| use ref|
|00000980| 65 72 73 20 74 6f 20 74 | 68 65 0a 62 69 6e 64 69 |ers to t|he.bindi|
|00000990| 6e 67 20 66 6f 72 20 74 | 68 65 20 76 61 72 69 61 |ng for t|he varia|
|000009a0| 62 6c 65 20 69 6e 20 74 | 68 65 20 74 6f 70 20 6c |ble in t|he top l|
|000009b0| 65 76 65 6c 20 65 6e 76 | 69 72 6f 6e 6d 65 6e 74 |evel env|ironment|
|000009c0| 2c 20 69 66 20 61 6e 79 | 0a 28 73 65 63 74 69 6f |, if any|.(sectio|
|000009d0| 6e 7e 5c 72 65 66 7b 69 | 6e 69 74 69 61 6c 65 6e |n~\ref{i|nitialen|
|000009e0| 76 7d 29 3b 20 69 66 20 | 74 68 65 72 65 20 69 73 |v}); if |there is|
|000009f0| 20 6e 6f 20 62 69 6e 64 | 69 6e 67 20 66 6f 72 20 | no bind|ing for |
|00000a00| 74 68 65 20 69 64 65 6e | 74 69 66 69 65 72 2c 0a |the iden|tifier,.|
|00000a10| 69 74 20 69 73 20 73 61 | 69 64 20 74 6f 20 62 65 |it is sa|id to be|
|00000a20| 20 5c 64 65 66 69 6e 69 | 6e 67 7b 75 6e 62 6f 75 | \defini|ng{unbou|
|00000a30| 6e 64 7d 2e 5c 6d 61 69 | 6e 69 6e 64 65 78 7b 62 |nd}.\mai|nindex{b|
|00000a40| 6f 75 6e 64 7d 5c 69 6e | 64 65 78 7b 74 6f 70 20 |ound}\in|dex{top |
|00000a50| 6c 65 76 65 6c 0a 65 6e | 76 69 72 6f 6e 6d 65 6e |level.en|vironmen|
|00000a60| 74 7d 0a 0a 5c 74 6f 64 | 6f 7b 4d 65 6e 74 69 6f |t}..\tod|o{Mentio|
|00000a70| 6e 20 74 68 61 74 20 73 | 6f 6d 65 20 69 6d 70 6c |n that s|ome impl|
|00000a80| 65 6d 65 6e 74 61 74 69 | 6f 6e 73 20 68 61 76 65 |ementati|ons have|
|00000a90| 20 6d 75 6c 74 69 70 6c | 65 20 74 6f 70 20 6c 65 | multipl|e top le|
|00000aa0| 76 65 6c 20 65 6e 76 69 | 72 6f 6e 6d 65 6e 74 73 |vel envi|ronments|
|00000ab0| 3f 7d 0a 0a 5c 74 6f 64 | 6f 7b 50 69 74 6d 61 6e |?}..\tod|o{Pitman|
|00000ac0| 20 73 65 7a 3a 20 6e 65 | 65 64 73 20 65 6c 61 62 | sez: ne|eds elab|
|00000ad0| 6f 72 61 74 69 6f 6e 20 | 69 6e 20 63 61 73 65 20 |oration |in case |
|00000ae0| 6f 66 20 7b 5c 74 74 28 | 6c 65 74 20 2e 2e 2e 29 |of {\tt(|let ...)|
|00000af0| 7d 7d 0a 0a 5c 74 6f 64 | 6f 7b 50 69 74 6d 61 6e |}}..\tod|o{Pitman|
|00000b00| 20 61 73 6b 73 3a 20 73 | 61 79 20 73 6f 6d 65 74 | asks: s|ay somet|
|00000b10| 68 69 6e 67 20 61 62 6f | 75 74 20 76 61 72 73 20 |hing abo|ut vars |
|00000b20| 63 72 65 61 74 65 64 20 | 61 66 74 65 72 20 73 63 |created |after sc|
|00000b30| 68 65 6d 65 20 73 74 61 | 72 74 73 3f 0a 7b 5c 74 |heme sta|rts?.{\t|
|00000b40| 74 20 28 64 65 66 69 6e | 65 20 78 20 33 29 20 28 |t (defin|e x 3) (|
|00000b50| 64 65 66 69 6e 65 20 28 | 66 29 20 78 29 20 28 64 |define (|f) x) (d|
|00000b60| 65 66 69 6e 65 20 28 67 | 29 20 79 29 20 28 64 65 |efine (g|) y) (de|
|00000b70| 66 69 6e 65 20 79 20 34 | 29 7d 0a 43 6c 69 6e 67 |fine y 4|)}.Cling|
|00000b80| 65 72 20 72 65 70 6c 69 | 65 73 3a 20 54 68 65 20 |er repli|es: The |
|00000b90| 6c 61 6e 67 75 61 67 65 | 20 77 61 73 20 65 78 70 |language| was exp|
|00000ba0| 6c 69 63 69 74 6c 79 0a | 64 65 73 69 67 6e 65 64 |licitly.|designed|
|00000bb0| 20 74 6f 20 70 65 72 6d | 69 74 20 61 20 76 69 65 | to perm|it a vie|
|00000bc0| 77 20 69 6e 20 77 68 69 | 63 68 20 6e 6f 20 76 61 |w in whi|ch no va|
|00000bd0| 72 69 61 62 6c 65 73 20 | 61 72 65 20 63 72 65 61 |riables |are crea|
|00000be0| 74 65 64 20 61 66 74 65 | 72 0a 53 63 68 65 6d 65 |ted afte|r.Scheme|
|00000bf0| 20 73 74 61 72 74 73 2e | 20 20 49 6e 20 66 69 6c | starts.| In fil|
|00000c00| 65 73 2c 20 79 6f 75 20 | 63 61 6e 20 73 63 61 6e |es, you |can scan|
|00000c10| 20 6f 75 74 20 74 68 65 | 20 64 65 66 69 6e 69 74 | out the| definit|
|00000c20| 69 6f 6e 73 20 62 65 66 | 6f 72 65 68 61 6e 64 2e |ions bef|orehand.|
|00000c30| 0a 49 20 74 68 69 6e 6b | 20 77 65 27 72 65 20 61 |.I think| we're a|
|00000c40| 67 72 65 65 64 20 6f 6e | 20 74 68 65 20 70 72 69 |greed on| the pri|
|00000c50| 6e 63 69 70 6c 65 20 74 | 68 61 74 20 69 6e 74 65 |nciple t|hat inte|
|00000c60| 72 61 63 74 69 76 65 20 | 75 73 65 20 73 68 6f 75 |ractive |use shou|
|00000c70| 6c 64 0a 61 70 70 72 6f | 78 69 6d 61 74 65 20 74 |ld.appro|ximate t|
|00000c80| 68 61 74 20 62 65 68 61 | 76 69 6f 72 20 61 73 20 |hat beha|vior as |
|00000c90| 63 6c 6f 73 65 6c 79 20 | 61 73 20 70 6f 73 73 69 |closely |as possi|
|00000ca0| 62 6c 65 2c 20 74 68 6f | 75 67 68 20 77 65 20 64 |ble, tho|ugh we d|
|00000cb0| 6f 6e 27 74 20 79 65 74 | 0a 61 67 72 65 65 20 6f |on't yet|.agree o|
|00000cc0| 6e 20 77 68 69 63 68 20 | 70 72 6f 67 72 61 6d 6d |n which |programm|
|00000cd0| 69 6e 67 20 65 6e 76 69 | 72 6f 6e 6d 65 6e 74 20 |ing envi|ronment |
|00000ce0| 70 72 6f 76 69 64 65 73 | 20 74 68 65 20 62 65 73 |provides| the bes|
|00000cf0| 74 20 61 70 70 72 6f 78 | 69 6d 61 74 69 6f 6e 2e |t approx|imation.|
|00000d00| 7d 0a 0a 0a 5c 73 65 63 | 74 69 6f 6e 7b 54 72 75 |}...\sec|tion{Tru|
|00000d10| 65 20 61 6e 64 20 66 61 | 6c 73 65 7d 0a 0a 41 6e |e and fa|lse}..An|
|00000d20| 79 20 53 63 68 65 6d 65 | 20 76 61 6c 75 65 20 63 |y Scheme| value c|
|00000d30| 61 6e 20 62 65 20 75 73 | 65 64 20 61 73 20 61 20 |an be us|ed as a |
|00000d40| 62 6f 6f 6c 65 61 6e 20 | 76 61 6c 75 65 20 66 6f |boolean |value fo|
|00000d50| 72 20 74 68 65 20 70 75 | 72 70 6f 73 65 20 6f 66 |r the pu|rpose of|
|00000d60| 20 61 0a 63 6f 6e 64 69 | 74 69 6f 6e 61 6c 20 74 | a.condi|tional t|
|00000d70| 65 73 74 2e 20 20 41 73 | 20 65 78 70 6c 61 69 6e |est. As| explain|
|00000d80| 65 64 20 69 6e 20 73 65 | 63 74 69 6f 6e 7e 5c 72 |ed in se|ction~\r|
|00000d90| 65 66 7b 62 6f 6f 6c 65 | 61 6e 73 65 63 74 69 6f |ef{boole|ansectio|
|00000da0| 6e 7d 2c 20 61 6c 6c 0a | 76 61 6c 75 65 73 20 63 |n}, all.|values c|
|00000db0| 6f 75 6e 74 20 61 73 20 | 74 72 75 65 20 69 6e 20 |ount as |true in |
|00000dc0| 73 75 63 68 20 61 20 74 | 65 73 74 20 65 78 63 65 |such a t|est exce|
|00000dd0| 70 74 20 66 6f 72 20 5c | 73 63 68 66 61 6c 73 65 |pt for \|schfalse|
|00000de0| 7b 7d 2e 0a 25 20 61 6e | 64 20 70 6f 73 73 69 62 |{}..% an|d possib|
|00000df0| 6c 79 20 74 68 65 20 65 | 6d 70 74 79 20 6c 69 73 |ly the e|mpty lis|
|00000e00| 74 2e 0a 25 20 54 68 65 | 20 6f 6e 6c 79 20 76 61 |t..% The| only va|
|00000e10| 6c 75 65 20 74 68 61 74 | 20 69 73 20 67 75 61 72 |lue that| is guar|
|00000e20| 61 6e 74 65 65 64 20 74 | 6f 20 63 6f 75 6e 74 20 |anteed t|o count |
|00000e30| 61 73 0a 25 20 66 61 6c | 73 65 20 69 73 20 5c 73 |as.% fal|se is \s|
|00000e40| 63 68 66 61 6c 73 65 7b | 7d 2e 20 20 49 74 20 69 |chfalse{|}. It i|
|00000e50| 73 20 65 78 70 6c 69 63 | 69 74 6c 79 20 75 6e 73 |s explic|itly uns|
|00000e60| 70 65 63 69 66 69 65 64 | 20 77 68 65 74 68 65 72 |pecified| whether|
|00000e70| 20 74 68 65 20 65 6d 70 | 74 79 20 6c 69 73 74 0a | the emp|ty list.|
|00000e80| 25 20 63 6f 75 6e 74 73 | 20 61 73 20 74 72 75 65 |% counts| as true|
|00000e90| 20 6f 72 20 61 73 20 66 | 61 6c 73 65 2e 0a 54 68 | or as f|alse..Th|
|00000ea0| 69 73 20 72 65 70 6f 72 | 74 20 75 73 65 73 20 74 |is repor|t uses t|
|00000eb0| 68 65 20 77 6f 72 64 20 | 60 60 74 72 75 65 27 27 |he word |``true''|
|00000ec0| 20 74 6f 20 72 65 66 65 | 72 20 74 6f 20 61 6e 79 | to refe|r to any|
|00000ed0| 0a 53 63 68 65 6d 65 20 | 76 61 6c 75 65 20 74 68 |.Scheme |value th|
|00000ee0| 61 74 20 63 6f 75 6e 74 | 73 20 61 73 20 74 72 75 |at count|s as tru|
|00000ef0| 65 2c 20 61 6e 64 20 74 | 68 65 20 77 6f 72 64 20 |e, and t|he word |
|00000f00| 60 60 66 61 6c 73 65 27 | 27 20 74 6f 20 72 65 66 |``false'|' to ref|
|00000f10| 65 72 20 74 6f 0a 5c 73 | 63 68 66 61 6c 73 65 7b |er to.\s|chfalse{|
|00000f20| 7d 2e 20 5c 6d 61 69 6e | 69 6e 64 65 78 7b 74 72 |}. \main|index{tr|
|00000f30| 75 65 7d 20 5c 6d 61 69 | 6e 69 6e 64 65 78 7b 66 |ue} \mai|nindex{f|
|00000f40| 61 6c 73 65 7d 0a 0a 5c | 62 65 67 69 6e 7b 6e 6f |alse}..\|begin{no|
|00000f50| 74 65 7d 0a 49 6e 20 73 | 6f 6d 65 20 69 6d 70 6c |te}.In s|ome impl|
|00000f60| 65 6d 65 6e 74 61 74 69 | 6f 6e 73 20 74 68 65 20 |ementati|ons the |
|00000f70| 65 6d 70 74 79 20 6c 69 | 73 74 20 61 6c 73 6f 20 |empty li|st also |
|00000f80| 63 6f 75 6e 74 73 20 61 | 73 20 66 61 6c 73 65 20 |counts a|s false |
|00000f90| 69 6e 73 74 65 61 64 0a | 6f 66 20 74 72 75 65 2e |instead.|of true.|
|00000fa0| 0a 5c 65 6e 64 7b 6e 6f | 74 65 7d 0a 0a 5c 74 6f |.\end{no|te}..\to|
|00000fb0| 64 6f 7b 42 61 72 74 6c | 65 79 3a 20 74 69 67 68 |do{Bartl|ey: tigh|
|00000fc0| 74 65 6e 20 74 68 69 73 | 20 75 70 2e 7d 0a 0a 0a |ten this| up.}...|
|00000fd0| 5c 73 65 63 74 69 6f 6e | 7b 45 78 74 65 72 6e 61 |\section|{Externa|
|00000fe0| 6c 20 72 65 70 72 65 73 | 65 6e 74 61 74 69 6f 6e |l repres|entation|
|00000ff0| 73 7d 0a 5c 6c 61 62 65 | 6c 7b 65 78 74 65 72 6e |s}.\labe|l{extern|
|00001000| 61 6c 72 65 70 73 7d 0a | 0a 41 6e 20 69 6d 70 6f |alreps}.|.An impo|
|00001010| 72 74 61 6e 74 20 63 6f | 6e 63 65 70 74 20 69 6e |rtant co|ncept in|
|00001020| 20 53 63 68 65 6d 65 20 | 28 61 6e 64 20 4c 69 73 | Scheme |(and Lis|
|00001030| 70 29 20 69 73 20 74 68 | 61 74 20 6f 66 20 74 68 |p) is th|at of th|
|00001040| 65 20 7b 5c 65 6d 20 65 | 78 74 65 72 6e 61 6c 0a |e {\em e|xternal.|
|00001050| 72 65 70 72 65 73 65 6e | 74 61 74 69 6f 6e 7d 20 |represen|tation} |
|00001060| 6f 66 20 61 6e 20 6f 62 | 6a 65 63 74 20 61 73 20 |of an ob|ject as |
|00001070| 61 20 73 65 71 75 65 6e | 63 65 20 6f 66 20 63 68 |a sequen|ce of ch|
|00001080| 61 72 61 63 74 65 72 73 | 2e 20 20 46 6f 72 20 65 |aracters|. For e|
|00001090| 78 61 6d 70 6c 65 2c 0a | 61 6e 20 65 78 74 65 72 |xample,.|an exter|
|000010a0| 6e 61 6c 20 72 65 70 72 | 65 73 65 6e 74 61 74 69 |nal repr|esentati|
|000010b0| 6f 6e 20 6f 66 20 74 68 | 65 20 69 6e 74 65 67 65 |on of th|e intege|
|000010c0| 72 20 32 38 20 69 73 20 | 74 68 65 20 73 65 71 75 |r 28 is |the sequ|
|000010d0| 65 6e 63 65 20 6f 66 0a | 63 68 61 72 61 63 74 65 |ence of.|characte|
|000010e0| 72 73 20 60 60 7b 5c 74 | 74 20 32 38 7d 27 27 2c |rs ``{\t|t 28}'',|
|000010f0| 20 61 6e 64 20 61 6e 20 | 65 78 74 65 72 6e 61 6c | and an |external|
|00001100| 20 72 65 70 72 65 73 65 | 6e 74 61 74 69 6f 6e 20 | represe|ntation |
|00001110| 6f 66 20 61 20 6c 69 73 | 74 20 63 6f 6e 73 69 73 |of a lis|t consis|
|00001120| 74 69 6e 67 0a 6f 66 20 | 74 68 65 20 69 6e 74 65 |ting.of |the inte|
|00001130| 67 65 72 73 20 38 20 61 | 6e 64 20 31 33 20 69 73 |gers 8 a|nd 13 is|
|00001140| 20 74 68 65 20 73 65 71 | 75 65 6e 63 65 20 6f 66 | the seq|uence of|
|00001150| 20 63 68 61 72 61 63 74 | 65 72 73 20 60 60 7b 5c | charact|ers ``{\|
|00001160| 74 74 28 38 20 31 33 29 | 7d 27 27 2e 0a 0a 54 68 |tt(8 13)|}''...Th|
|00001170| 65 20 65 78 74 65 72 6e | 61 6c 20 72 65 70 72 65 |e extern|al repre|
|00001180| 73 65 6e 74 61 74 69 6f | 6e 20 6f 66 20 61 6e 20 |sentatio|n of an |
|00001190| 6f 62 6a 65 63 74 20 69 | 73 20 6e 6f 74 20 6e 65 |object i|s not ne|
|000011a0| 63 65 73 73 61 72 69 6c | 79 20 75 6e 69 71 75 65 |cessaril|y unique|
|000011b0| 2e 20 20 54 68 65 0a 69 | 6e 74 65 67 65 72 20 32 |. The.i|nteger 2|
|000011c0| 38 20 61 6c 73 6f 20 68 | 61 73 20 72 65 70 72 65 |8 also h|as repre|
|000011d0| 73 65 6e 74 61 74 69 6f | 6e 73 20 60 60 7b 5c 74 |sentatio|ns ``{\t|
|000011e0| 74 20 5c 23 65 32 38 2e | 30 30 30 7d 27 27 20 61 |t \#e28.|000}'' a|
|000011f0| 6e 64 20 60 60 7b 5c 74 | 74 5c 23 78 31 63 7d 27 |nd ``{\t|t\#x1c}'|
|00001200| 27 2c 20 61 6e 64 20 74 | 68 65 0a 6c 69 73 74 20 |', and t|he.list |
|00001210| 69 6e 20 74 68 65 20 70 | 72 65 76 69 6f 75 73 20 |in the p|revious |
|00001220| 70 61 72 61 67 72 61 70 | 68 20 61 6c 73 6f 20 68 |paragrap|h also h|
|00001230| 61 73 20 74 68 65 20 72 | 65 70 72 65 73 65 6e 74 |as the r|epresent|
|00001240| 61 74 69 6f 6e 73 20 60 | 60 7b 5c 74 74 28 20 30 |ations `|`{\tt( 0|
|00001250| 38 20 31 33 0a 29 7d 27 | 27 20 61 6e 64 20 60 60 |8 13.)}'|' and ``|
|00001260| 7b 5c 74 74 28 38 20 2e | 5c 20 28 31 33 20 2e 5c |{\tt(8 .|\ (13 .\|
|00001270| 20 28 29 29 29 7d 27 27 | 20 28 73 65 65 20 73 65 | ()))}''| (see se|
|00001280| 63 74 69 6f 6e 7e 5c 72 | 65 66 7b 6c 69 73 74 73 |ction~\r|ef{lists|
|00001290| 65 63 74 69 6f 6e 7d 29 | 2e 0a 0a 4d 61 6e 79 20 |ection})|...Many |
|000012a0| 6f 62 6a 65 63 74 73 20 | 68 61 76 65 20 73 74 61 |objects |have sta|
|000012b0| 6e 64 61 72 64 20 65 78 | 74 65 72 6e 61 6c 20 72 |ndard ex|ternal r|
|000012c0| 65 70 72 65 73 65 6e 74 | 61 74 69 6f 6e 73 2c 20 |epresent|ations, |
|000012d0| 62 75 74 20 73 6f 6d 65 | 2c 20 73 75 63 68 20 61 |but some|, such a|
|000012e0| 73 0a 70 72 6f 63 65 64 | 75 72 65 73 2c 20 64 6f |s.proced|ures, do|
|000012f0| 20 6e 6f 74 20 68 61 76 | 65 20 73 74 61 6e 64 61 | not hav|e standa|
|00001300| 72 64 20 72 65 70 72 65 | 73 65 6e 74 61 74 69 6f |rd repre|sentatio|
|00001310| 6e 73 20 28 61 6c 74 68 | 6f 75 67 68 20 70 61 72 |ns (alth|ough par|
|00001320| 74 69 63 75 6c 61 72 0a | 69 6d 70 6c 65 6d 65 6e |ticular.|implemen|
|00001330| 74 61 74 69 6f 6e 73 20 | 6d 61 79 20 64 65 66 69 |tations |may defi|
|00001340| 6e 65 20 72 65 70 72 65 | 73 65 6e 74 61 74 69 6f |ne repre|sentatio|
|00001350| 6e 73 20 66 6f 72 20 74 | 68 65 6d 29 2e 0a 0a 41 |ns for t|hem)...A|
|00001360| 6e 20 65 78 74 65 72 6e | 61 6c 20 72 65 70 72 65 |n extern|al repre|
|00001370| 73 65 6e 74 61 74 69 6f | 6e 20 6d 61 79 20 62 65 |sentatio|n may be|
|00001380| 20 77 72 69 74 74 65 6e | 20 69 6e 20 61 20 70 72 | written| in a pr|
|00001390| 6f 67 72 61 6d 20 74 6f | 20 6f 62 74 61 69 6e 20 |ogram to| obtain |
|000013a0| 74 68 65 0a 63 6f 72 72 | 65 73 70 6f 6e 64 69 6e |the.corr|espondin|
|000013b0| 67 20 6f 62 6a 65 63 74 | 20 28 73 65 65 20 5c 69 |g object| (see \i|
|000013c0| 64 65 7b 71 75 6f 74 65 | 7d 2c 20 73 65 63 74 69 |de{quote|}, secti|
|000013d0| 6f 6e 7e 5c 72 65 66 7b | 71 75 6f 74 65 7d 29 2e |on~\ref{|quote}).|
|000013e0| 0a 0a 45 78 74 65 72 6e | 61 6c 20 72 65 70 72 65 |..Extern|al repre|
|000013f0| 73 65 6e 74 61 74 69 6f | 6e 73 20 63 61 6e 20 61 |sentatio|ns can a|
|00001400| 6c 73 6f 20 62 65 20 75 | 73 65 64 20 66 6f 72 20 |lso be u|sed for |
|00001410| 69 6e 70 75 74 20 61 6e | 64 20 6f 75 74 70 75 74 |input an|d output|
|00001420| 2e 20 20 54 68 65 0a 70 | 72 6f 63 65 64 75 72 65 |. The.p|rocedure|
|00001430| 20 5c 69 64 65 7b 72 65 | 61 64 7d 20 28 73 65 63 | \ide{re|ad} (sec|
|00001440| 74 69 6f 6e 7e 5c 72 65 | 66 7b 72 65 61 64 7d 29 |tion~\re|f{read})|
|00001450| 20 70 61 72 73 65 73 20 | 65 78 74 65 72 6e 61 6c | parses |external|
|00001460| 0a 72 65 70 72 65 73 65 | 6e 74 61 74 69 6f 6e 73 |.represe|ntations|
|00001470| 2c 20 61 6e 64 20 74 68 | 65 20 70 72 6f 63 65 64 |, and th|e proced|
|00001480| 75 72 65 20 5c 69 64 65 | 7b 77 72 69 74 65 7d 20 |ure \ide|{write} |
|00001490| 28 73 65 63 74 69 6f 6e | 7e 5c 72 65 66 7b 77 72 |(section|~\ref{wr|
|000014a0| 69 74 65 7d 29 0a 67 65 | 6e 65 72 61 74 65 73 20 |ite}).ge|nerates |
|000014b0| 74 68 65 6d 2e 20 20 54 | 6f 67 65 74 68 65 72 2c |them. T|ogether,|
|000014c0| 20 74 68 65 79 20 70 72 | 6f 76 69 64 65 20 61 6e | they pr|ovide an|
|000014d0| 20 65 6c 65 67 61 6e 74 | 20 61 6e 64 20 70 6f 77 | elegant| and pow|
|000014e0| 65 72 66 75 6c 0a 69 6e | 70 75 74 2f 6f 75 74 70 |erful.in|put/outp|
|000014f0| 75 74 20 66 61 63 69 6c | 69 74 79 2e 0a 0a 4e 6f |ut facil|ity...No|
|00001500| 74 65 20 74 68 61 74 20 | 74 68 65 20 73 65 71 75 |te that |the sequ|
|00001510| 65 6e 63 65 20 6f 66 20 | 63 68 61 72 61 63 74 65 |ence of |characte|
|00001520| 72 73 20 60 60 7b 5c 74 | 74 28 2b 20 32 20 36 29 |rs ``{\t|t(+ 2 6)|
|00001530| 7d 27 27 20 69 73 20 7b | 5c 65 6d 20 6e 6f 74 7d |}'' is {|\em not}|
|00001540| 20 61 6e 0a 65 78 74 65 | 72 6e 61 6c 20 72 65 70 | an.exte|rnal rep|
|00001550| 72 65 73 65 6e 74 61 74 | 69 6f 6e 20 6f 66 20 74 |resentat|ion of t|
|00001560| 68 65 20 69 6e 74 65 67 | 65 72 20 38 2c 20 65 76 |he integ|er 8, ev|
|00001570| 65 6e 20 74 68 6f 75 67 | 68 20 69 74 20 7b 5c 65 |en thoug|h it {\e|
|00001580| 6d 20 69 73 7d 20 61 6e | 0a 65 78 70 72 65 73 73 |m is} an|.express|
|00001590| 69 6f 6e 20 65 76 61 6c | 75 61 74 69 6e 67 20 74 |ion eval|uating t|
|000015a0| 6f 20 74 68 65 20 69 6e | 74 65 67 65 72 20 38 3b |o the in|teger 8;|
|000015b0| 20 72 61 74 68 65 72 2c | 20 69 74 20 69 73 20 61 | rather,| it is a|
|000015c0| 6e 20 65 78 74 65 72 6e | 61 6c 0a 72 65 70 72 65 |n extern|al.repre|
|000015d0| 73 65 6e 74 61 74 69 6f | 6e 20 6f 66 20 61 20 74 |sentatio|n of a t|
|000015e0| 68 72 65 65 2d 65 6c 65 | 6d 65 6e 74 20 6c 69 73 |hree-ele|ment lis|
|000015f0| 74 2c 20 74 68 65 20 65 | 6c 65 6d 65 6e 74 73 20 |t, the e|lements |
|00001600| 6f 66 20 77 68 69 63 68 | 20 61 72 65 20 74 68 65 |of which| are the|
|00001610| 20 73 79 6d 62 6f 6c 0a | 7b 5c 74 74 20 2b 7d 20 | symbol.|{\tt +} |
|00001620| 61 6e 64 20 74 68 65 20 | 69 6e 74 65 67 65 72 73 |and the |integers|
|00001630| 20 32 20 61 6e 64 20 36 | 2e 20 20 53 63 68 65 6d | 2 and 6|. Schem|
|00001640| 65 27 73 20 73 79 6e 74 | 61 78 20 68 61 73 20 74 |e's synt|ax has t|
|00001650| 68 65 20 70 72 6f 70 65 | 72 74 79 20 74 68 61 74 |he prope|rty that|
|00001660| 0a 61 6e 79 20 73 65 71 | 75 65 6e 63 65 20 6f 66 |.any seq|uence of|
|00001670| 20 63 68 61 72 61 63 74 | 65 72 73 20 74 68 61 74 | charact|ers that|
|00001680| 20 69 73 20 61 6e 20 65 | 78 70 72 65 73 73 69 6f | is an e|xpressio|
|00001690| 6e 20 69 73 20 61 6c 73 | 6f 20 74 68 65 20 65 78 |n is als|o the ex|
|000016a0| 74 65 72 6e 61 6c 0a 72 | 65 70 72 65 73 65 6e 74 |ternal.r|epresent|
|000016b0| 61 74 69 6f 6e 20 6f 66 | 20 73 6f 6d 65 20 6f 62 |ation of| some ob|
|000016c0| 6a 65 63 74 2e 20 20 54 | 68 69 73 20 63 61 6e 20 |ject. T|his can |
|000016d0| 6c 65 61 64 20 74 6f 20 | 63 6f 6e 66 75 73 69 6f |lead to |confusio|
|000016e0| 6e 2c 20 73 69 6e 63 65 | 20 69 74 20 6d 61 79 0a |n, since| it may.|
|000016f0| 6e 6f 74 20 62 65 20 6f | 62 76 69 6f 75 73 20 6f |not be o|bvious o|
|00001700| 75 74 20 6f 66 20 63 6f | 6e 74 65 78 74 20 77 68 |ut of co|ntext wh|
|00001710| 65 74 68 65 72 20 61 20 | 67 69 76 65 6e 20 73 65 |ether a |given se|
|00001720| 71 75 65 6e 63 65 20 6f | 66 20 63 68 61 72 61 63 |quence o|f charac|
|00001730| 74 65 72 73 20 69 73 0a | 69 6e 74 65 6e 64 65 64 |ters is.|intended|
|00001740| 20 74 6f 20 64 65 6e 6f | 74 65 20 64 61 74 61 20 | to deno|te data |
|00001750| 6f 72 20 70 72 6f 67 72 | 61 6d 2c 20 62 75 74 20 |or progr|am, but |
|00001760| 69 74 20 69 73 20 61 6c | 73 6f 20 61 20 73 6f 75 |it is al|so a sou|
|00001770| 72 63 65 20 6f 66 20 70 | 6f 77 65 72 2c 0a 73 69 |rce of p|ower,.si|
|00001780| 6e 63 65 20 69 74 20 66 | 61 63 69 6c 69 74 61 74 |nce it f|acilitat|
|00001790| 65 73 20 77 72 69 74 69 | 6e 67 20 70 72 6f 67 72 |es writi|ng progr|
|000017a0| 61 6d 73 20 73 75 63 68 | 20 61 73 20 69 6e 74 65 |ams such| as inte|
|000017b0| 72 70 72 65 74 65 72 73 | 20 61 6e 64 0a 63 6f 6d |rpreters| and.com|
|000017c0| 70 69 6c 65 72 73 20 74 | 68 61 74 20 74 72 65 61 |pilers t|hat trea|
|000017d0| 74 20 70 72 6f 67 72 61 | 6d 73 20 61 73 20 64 61 |t progra|ms as da|
|000017e0| 74 61 20 28 6f 72 20 76 | 69 63 65 20 76 65 72 73 |ta (or v|ice vers|
|000017f0| 61 29 2e 0a 0a 54 68 65 | 20 73 79 6e 74 61 78 20 |a)...The| syntax |
|00001800| 6f 66 20 65 78 74 65 72 | 6e 61 6c 20 72 65 70 72 |of exter|nal repr|
|00001810| 65 73 65 6e 74 61 74 69 | 6f 6e 73 20 6f 66 20 76 |esentati|ons of v|
|00001820| 61 72 69 6f 75 73 20 6b | 69 6e 64 73 20 6f 66 20 |arious k|inds of |
|00001830| 6f 62 6a 65 63 74 73 0a | 61 63 63 6f 6d 70 61 6e |objects.|accompan|
|00001840| 69 65 73 20 74 68 65 20 | 64 65 73 63 72 69 70 74 |ies the |descript|
|00001850| 69 6f 6e 20 6f 66 20 74 | 68 65 20 70 72 69 6d 69 |ion of t|he primi|
|00001860| 74 69 76 65 73 20 66 6f | 72 20 6d 61 6e 69 70 75 |tives fo|r manipu|
|00001870| 6c 61 74 69 6e 67 20 74 | 68 65 0a 6f 62 6a 65 63 |lating t|he.objec|
|00001880| 74 73 20 69 6e 20 74 68 | 65 20 61 70 70 72 6f 70 |ts in th|e approp|
|00001890| 72 69 61 74 65 20 73 65 | 63 74 69 6f 6e 73 20 6f |riate se|ctions o|
|000018a0| 66 20 63 68 61 70 74 65 | 72 7e 5c 72 65 66 7b 69 |f chapte|r~\ref{i|
|000018b0| 6e 69 74 69 61 6c 65 6e | 76 7d 2e 0a 0a 0a 5c 73 |nitialen|v}....\s|
|000018c0| 65 63 74 69 6f 6e 7b 44 | 69 73 6a 6f 69 6e 74 6e |ection{D|isjointn|
|000018d0| 65 73 73 20 6f 66 20 74 | 79 70 65 73 7d 0a 5c 6c |ess of t|ypes}.\l|
|000018e0| 61 62 65 6c 7b 64 69 73 | 6a 6f 69 6e 74 6e 65 73 |abel{dis|jointnes|
|000018f0| 73 7d 0a 0a 4e 6f 20 6f | 62 6a 65 63 74 20 73 61 |s}..No o|bject sa|
|00001900| 74 69 73 66 69 65 73 20 | 6d 6f 72 65 20 74 68 61 |tisfies |more tha|
|00001910| 6e 20 6f 6e 65 20 6f 66 | 20 74 68 65 20 66 6f 6c |n one of| the fol|
|00001920| 6c 6f 77 69 6e 67 20 70 | 72 65 64 69 63 61 74 65 |lowing p|redicate|
|00001930| 73 3a 0a 0a 5c 62 65 67 | 69 6e 7b 73 63 68 65 6d |s:..\beg|in{schem|
|00001940| 65 7d 0a 62 6f 6f 6c 65 | 61 6e 3f 20 20 20 20 20 |e}.boole|an? |
|00001950| 20 20 20 20 20 70 61 69 | 72 3f 0a 73 79 6d 62 6f | pai|r?.symbo|
|00001960| 6c 3f 20 20 20 20 20 20 | 20 20 20 20 20 6e 75 6d |l? | num|
|00001970| 62 65 72 3f 0a 63 68 61 | 72 3f 20 20 20 20 20 20 |ber?.cha|r? |
|00001980| 20 20 20 20 20 20 20 73 | 74 72 69 6e 67 3f 0a 76 | s|tring?.v|
|00001990| 65 63 74 6f 72 3f 20 20 | 20 20 20 20 20 20 20 20 |ector? | |
|000019a0| 20 70 72 6f 63 65 64 75 | 72 65 3f 25 0a 5c 65 6e | procedu|re?%.\en|
|000019b0| 64 7b 73 63 68 65 6d 65 | 7d 0a 0a 54 68 65 73 65 |d{scheme|}..These|
|000019c0| 20 70 72 65 64 69 63 61 | 74 65 73 20 64 65 66 69 | predica|tes defi|
|000019d0| 6e 65 20 74 68 65 20 74 | 79 70 65 73 20 7b 5c 65 |ne the t|ypes {\e|
|000019e0| 6d 20 62 6f 6f 6c 65 61 | 6e 7d 2c 20 7b 5c 65 6d |m boolea|n}, {\em|
|000019f0| 20 70 61 69 72 7d 2c 20 | 7b 5c 65 6d 0a 73 79 6d | pair}, |{\em.sym|
|00001a00| 62 6f 6c 7d 2c 20 7b 5c | 65 6d 20 6e 75 6d 62 65 |bol}, {\|em numbe|
|00001a10| 72 7d 2c 20 7b 5c 65 6d | 20 63 68 61 72 7d 20 28 |r}, {\em| char} (|
|00001a20| 6f 72 20 7b 5c 65 6d 20 | 63 68 61 72 61 63 74 65 |or {\em |characte|
|00001a30| 72 7d 29 2c 20 7b 5c 65 | 6d 20 73 74 72 69 6e 67 |r}), {\e|m string|
|00001a40| 7d 2c 20 7b 5c 65 6d 0a | 76 65 63 74 6f 72 7d 2c |}, {\em.|vector},|
|00001a50| 20 61 6e 64 20 7b 5c 65 | 6d 20 70 72 6f 63 65 64 | and {\e|m proced|
|00001a60| 75 72 65 7d 2e 5c 6d 61 | 69 6e 69 6e 64 65 78 7b |ure}.\ma|inindex{|
|00001a70| 74 79 70 65 7d 0a 0a 0a | 5c 73 65 63 74 69 6f 6e |type}...|\section|
|00001a80| 7b 53 74 6f 72 61 67 65 | 20 6d 6f 64 65 6c 7d 0a |{Storage| model}.|
|00001a90| 5c 6c 61 62 65 6c 7b 73 | 74 6f 72 61 67 65 6d 6f |\label{s|toragemo|
|00001aa0| 64 65 6c 7d 0a 0a 56 61 | 72 69 61 62 6c 65 73 20 |del}..Va|riables |
|00001ab0| 61 6e 64 20 6f 62 6a 65 | 63 74 73 20 73 75 63 68 |and obje|cts such|
|00001ac0| 20 61 73 20 70 61 69 72 | 73 2c 20 76 65 63 74 6f | as pair|s, vecto|
|00001ad0| 72 73 2c 20 61 6e 64 20 | 73 74 72 69 6e 67 73 20 |rs, and |strings |
|00001ae0| 69 6d 70 6c 69 63 69 74 | 6c 79 0a 64 65 6e 6f 74 |implicit|ly.denot|
|00001af0| 65 20 6c 6f 63 61 74 69 | 6f 6e 73 5c 6d 61 69 6e |e locati|ons\main|
|00001b00| 69 6e 64 65 78 7b 6c 6f | 63 61 74 69 6f 6e 7d 20 |index{lo|cation} |
|00001b10| 6f 72 20 73 65 71 75 65 | 6e 63 65 73 20 6f 66 20 |or seque|nces of |
|00001b20| 6c 6f 63 61 74 69 6f 6e | 73 2e 20 20 41 20 73 74 |location|s. A st|
|00001b30| 72 69 6e 67 2c 20 66 6f | 72 0a 65 78 61 6d 70 6c |ring, fo|r.exampl|
|00001b40| 65 2c 20 64 65 6e 6f 74 | 65 73 20 61 73 20 6d 61 |e, denot|es as ma|
|00001b50| 6e 79 20 6c 6f 63 61 74 | 69 6f 6e 73 20 61 73 20 |ny locat|ions as |
|00001b60| 74 68 65 72 65 20 61 72 | 65 20 63 68 61 72 61 63 |there ar|e charac|
|00001b70| 74 65 72 73 20 69 6e 20 | 74 68 65 20 73 74 72 69 |ters in |the stri|
|00001b80| 6e 67 2e 20 0a 28 54 68 | 65 73 65 20 6c 6f 63 61 |ng. .(Th|ese loca|
|00001b90| 74 69 6f 6e 73 20 6e 65 | 65 64 20 6e 6f 74 20 63 |tions ne|ed not c|
|00001ba0| 6f 72 72 65 73 70 6f 6e | 64 20 74 6f 20 61 20 66 |orrespon|d to a f|
|00001bb0| 75 6c 6c 20 6d 61 63 68 | 69 6e 65 20 77 6f 72 64 |ull mach|ine word|
|00001bc0| 2e 29 20 41 20 6e 65 77 | 20 76 61 6c 75 65 20 6d |.) A new| value m|
|00001bd0| 61 79 20 62 65 0a 73 74 | 6f 72 65 64 20 69 6e 74 |ay be.st|ored int|
|00001be0| 6f 20 6f 6e 65 20 6f 66 | 20 74 68 65 73 65 20 6c |o one of| these l|
|00001bf0| 6f 63 61 74 69 6f 6e 73 | 20 75 73 69 6e 67 20 74 |ocations| using t|
|00001c00| 68 65 20 7b 5c 74 74 20 | 73 74 72 69 6e 67 2d 73 |he {\tt |string-s|
|00001c10| 65 74 21 7d 20 70 72 6f | 63 65 64 75 72 65 2c 20 |et!} pro|cedure, |
|00001c20| 62 75 74 0a 74 68 65 20 | 73 74 72 69 6e 67 20 63 |but.the |string c|
|00001c30| 6f 6e 74 69 6e 75 65 73 | 20 74 6f 20 64 65 6e 6f |ontinues| to deno|
|00001c40| 74 65 20 74 68 65 20 73 | 61 6d 65 20 6c 6f 63 61 |te the s|ame loca|
|00001c50| 74 69 6f 6e 73 20 61 73 | 20 62 65 66 6f 72 65 2e |tions as| before.|
|00001c60| 0a 0a 41 6e 20 6f 62 6a | 65 63 74 20 66 65 74 63 |..An obj|ect fetc|
|00001c70| 68 65 64 20 66 72 6f 6d | 20 61 20 6c 6f 63 61 74 |hed from| a locat|
|00001c80| 69 6f 6e 2c 20 62 79 20 | 61 20 76 61 72 69 61 62 |ion, by |a variab|
|00001c90| 6c 65 20 72 65 66 65 72 | 65 6e 63 65 20 6f 72 20 |le refer|ence or |
|00001ca0| 62 79 0a 61 20 70 72 6f | 63 65 64 75 72 65 20 73 |by.a pro|cedure s|
|00001cb0| 75 63 68 20 61 73 20 5c | 69 64 65 7b 63 61 72 7d |uch as \|ide{car}|
|00001cc0| 2c 20 5c 69 64 65 7b 76 | 65 63 74 6f 72 2d 72 65 |, \ide{v|ector-re|
|00001cd0| 66 7d 2c 20 6f 72 20 5c | 69 64 65 7b 73 74 72 69 |f}, or \|ide{stri|
|00001ce0| 6e 67 2d 72 65 66 7d 2c | 20 69 73 0a 65 71 75 69 |ng-ref},| is.equi|
|00001cf0| 76 61 6c 65 6e 74 20 69 | 6e 20 74 68 65 20 73 65 |valent i|n the se|
|00001d00| 6e 73 65 20 6f 66 20 5c | 69 64 65 7b 65 71 76 3f |nse of \|ide{eqv?|
|00001d10| 7d 20 28 73 65 63 74 69 | 6f 6e 7e 5c 72 65 66 7b |} (secti|on~\ref{|
|00001d20| 65 71 75 69 76 61 6c 65 | 6e 63 65 73 65 63 74 69 |equivale|ncesecti|
|00001d30| 6f 6e 7d 29 0a 74 6f 20 | 74 68 65 20 6f 62 6a 65 |on}).to |the obje|
|00001d40| 63 74 20 6c 61 73 74 20 | 73 74 6f 72 65 64 20 69 |ct last |stored i|
|00001d50| 6e 20 74 68 65 20 6c 6f | 63 61 74 69 6f 6e 20 62 |n the lo|cation b|
|00001d60| 65 66 6f 72 65 20 74 68 | 65 20 66 65 74 63 68 2e |efore th|e fetch.|
|00001d70| 0a 0a 45 76 65 72 79 20 | 6c 6f 63 61 74 69 6f 6e |..Every |location|
|00001d80| 20 69 73 20 6d 61 72 6b | 65 64 20 74 6f 20 73 68 | is mark|ed to sh|
|00001d90| 6f 77 20 77 68 65 74 68 | 65 72 20 69 74 20 69 73 |ow wheth|er it is|
|00001da0| 20 69 6e 20 75 73 65 2e | 0a 4e 6f 20 76 61 72 69 | in use.|.No vari|
|00001db0| 61 62 6c 65 20 6f 72 20 | 6f 62 6a 65 63 74 20 65 |able or |object e|
|00001dc0| 76 65 72 20 72 65 66 65 | 72 73 20 74 6f 20 61 20 |ver refe|rs to a |
|00001dd0| 6c 6f 63 61 74 69 6f 6e | 20 74 68 61 74 20 69 73 |location| that is|
|00001de0| 20 6e 6f 74 20 69 6e 20 | 75 73 65 2e 0a 57 68 65 | not in |use..Whe|
|00001df0| 6e 65 76 65 72 20 74 68 | 69 73 20 72 65 70 6f 72 |never th|is repor|
|00001e00| 74 20 73 70 65 61 6b 73 | 20 6f 66 20 73 74 6f 72 |t speaks| of stor|
|00001e10| 61 67 65 20 62 65 69 6e | 67 20 61 6c 6c 6f 63 61 |age bein|g alloca|
|00001e20| 74 65 64 20 66 6f 72 20 | 61 20 76 61 72 69 61 62 |ted for |a variab|
|00001e30| 6c 65 0a 6f 72 20 6f 62 | 6a 65 63 74 2c 20 77 68 |le.or ob|ject, wh|
|00001e40| 61 74 20 69 73 20 6d 65 | 61 6e 74 20 69 73 20 74 |at is me|ant is t|
|00001e50| 68 61 74 20 61 6e 20 61 | 70 70 72 6f 70 72 69 61 |hat an a|ppropria|
|00001e60| 74 65 20 6e 75 6d 62 65 | 72 20 6f 66 20 6c 6f 63 |te numbe|r of loc|
|00001e70| 61 74 69 6f 6e 73 20 61 | 72 65 0a 63 68 6f 73 65 |ations a|re.chose|
|00001e80| 6e 20 66 72 6f 6d 20 74 | 68 65 20 73 65 74 20 6f |n from t|he set o|
|00001e90| 66 20 6c 6f 63 61 74 69 | 6f 6e 73 20 74 68 61 74 |f locati|ons that|
|00001ea0| 20 61 72 65 20 6e 6f 74 | 20 69 6e 20 75 73 65 2c | are not| in use,|
|00001eb0| 20 61 6e 64 20 74 68 65 | 20 63 68 6f 73 65 6e 0a | and the| chosen.|
|00001ec0| 6c 6f 63 61 74 69 6f 6e | 73 20 61 72 65 20 6d 61 |location|s are ma|
|00001ed0| 72 6b 65 64 20 74 6f 20 | 69 6e 64 69 63 61 74 65 |rked to |indicate|
|00001ee0| 20 74 68 61 74 20 74 68 | 65 79 20 61 72 65 20 6e | that th|ey are n|
|00001ef0| 6f 77 20 69 6e 20 75 73 | 65 20 62 65 66 6f 72 65 |ow in us|e before|
|00001f00| 20 74 68 65 20 76 61 72 | 69 61 62 6c 65 0a 6f 72 | the var|iable.or|
|00001f10| 20 6f 62 6a 65 63 74 20 | 69 73 20 6d 61 64 65 20 | object |is made |
|00001f20| 74 6f 20 64 65 6e 6f 74 | 65 20 74 68 65 6d 2e 0a |to denot|e them..|
|00001f30| 0a 49 6e 20 6d 61 6e 79 | 20 73 79 73 74 65 6d 73 |.In many| systems|
|00001f40| 20 69 74 20 69 73 20 64 | 65 73 69 72 61 62 6c 65 | it is d|esirable|
|00001f50| 20 66 6f 72 20 63 6f 6e | 73 74 61 6e 74 73 5c 69 | for con|stants\i|
|00001f60| 6e 64 65 78 7b 63 6f 6e | 73 74 61 6e 74 7d 20 28 |ndex{con|stant} (|
|00001f70| 69 2e 65 2e 20 74 68 65 | 20 76 61 6c 75 65 73 20 |i.e. the| values |
|00001f80| 6f 66 0a 6c 69 74 65 72 | 61 6c 20 65 78 70 72 65 |of.liter|al expre|
|00001f90| 73 73 69 6f 6e 73 29 20 | 74 6f 20 72 65 73 69 64 |ssions) |to resid|
|00001fa0| 65 20 69 6e 20 72 65 61 | 64 2d 6f 6e 6c 79 2d 6d |e in rea|d-only-m|
|00001fb0| 65 6d 6f 72 79 2e 20 20 | 54 6f 20 65 78 70 72 65 |emory. |To expre|
|00001fc0| 73 73 20 74 68 69 73 2c | 20 69 74 20 69 73 0a 63 |ss this,| it is.c|
|00001fd0| 6f 6e 76 65 6e 69 65 6e | 74 20 74 6f 20 69 6d 61 |onvenien|t to ima|
|00001fe0| 67 69 6e 65 20 74 68 61 | 74 20 65 76 65 72 79 20 |gine tha|t every |
|00001ff0| 6f 62 6a 65 63 74 20 74 | 68 61 74 20 64 65 6e 6f |object t|hat deno|
|00002000| 74 65 73 20 6c 6f 63 61 | 74 69 6f 6e 73 20 69 73 |tes loca|tions is|
|00002010| 20 61 73 73 6f 63 69 61 | 74 65 64 0a 77 69 74 68 | associa|ted.with|
|00002020| 20 61 20 66 6c 61 67 20 | 74 65 6c 6c 69 6e 67 20 | a flag |telling |
|00002030| 77 68 65 74 68 65 72 20 | 74 68 61 74 20 6f 62 6a |whether |that obj|
|00002040| 65 63 74 20 69 73 20 6d | 75 74 61 62 6c 65 5c 69 |ect is m|utable\i|
|00002050| 6e 64 65 78 7b 6d 75 74 | 61 62 6c 65 7d 20 6f 72 |ndex{mut|able} or|
|00002060| 0a 69 6d 6d 75 74 61 62 | 6c 65 5c 69 6e 64 65 78 |.immutab|le\index|
|00002070| 7b 69 6d 6d 75 74 61 62 | 6c 65 7d 2e 20 20 54 68 |{immutab|le}. Th|
|00002080| 65 20 63 6f 6e 73 74 61 | 6e 74 73 20 61 6e 64 20 |e consta|nts and |
|00002090| 74 68 65 20 73 74 72 69 | 6e 67 73 20 72 65 74 75 |the stri|ngs retu|
|000020a0| 72 6e 65 64 20 62 79 0a | 5c 69 64 65 7b 73 79 6d |rned by.|\ide{sym|
|000020b0| 62 6f 6c 2d 3e 73 74 72 | 69 6e 67 7d 20 61 72 65 |bol->str|ing} are|
|000020c0| 20 74 68 65 6e 20 74 68 | 65 20 69 6d 6d 75 74 61 | then th|e immuta|
|000020d0| 62 6c 65 20 6f 62 6a 65 | 63 74 73 2c 20 77 68 69 |ble obje|cts, whi|
|000020e0| 6c 65 20 61 6c 6c 20 6f | 62 6a 65 63 74 73 20 63 |le all o|bjects c|
|000020f0| 72 65 61 74 65 64 20 62 | 79 0a 74 68 65 20 6f 74 |reated b|y.the ot|
|00002100| 68 65 72 20 70 72 6f 63 | 65 64 75 72 65 73 20 6c |her proc|edures l|
|00002110| 69 73 74 65 64 20 69 6e | 20 74 68 69 73 20 72 65 |isted in| this re|
|00002120| 70 6f 72 74 20 61 72 65 | 20 6d 75 74 61 62 6c 65 |port are| mutable|
|00002130| 2e 20 20 49 74 20 69 73 | 20 61 6e 20 65 72 72 6f |. It is| an erro|
|00002140| 72 20 74 6f 0a 61 74 74 | 65 6d 70 74 20 74 6f 20 |r to.att|empt to |
|00002150| 73 74 6f 72 65 20 61 20 | 6e 65 77 20 76 61 6c 75 |store a |new valu|
|00002160| 65 20 69 6e 74 6f 20 61 | 20 6c 6f 63 61 74 69 6f |e into a| locatio|
|00002170| 6e 20 74 68 61 74 20 69 | 73 20 64 65 6e 6f 74 65 |n that i|s denote|
|00002180| 64 20 62 79 20 61 6e 20 | 69 6d 6d 75 74 61 62 6c |d by an |immutabl|
|00002190| 65 0a 6f 62 6a 65 63 74 | 2e 0a |e.object|.. |
+--------+-------------------------+-------------------------+--------+--------+